# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
#    conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
#    of conditions and the following disclaimer in the documentation and/or other materials
#    provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
#    to endorse or promote products derived from this software without specific prior written
#    permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

include $(LITEOSTOPDIR)/config.mk
include $(LITEOSTOPDIR)/../../drivers/adapter/khdf/liteos/lite.mk

########################## WIFI IC ############################
CONFIG_RTL8188EUS = n
CONFIG_RTL8188FU= n
CONFIG_RTL8821AU = n
CONFIG_RTL8189FS = n
CONFIG_RTL8192FC = n
CONFIG_RTL8821CU= n
CONFIG_RTL8821CS = y



######################### Interface ###########################
CONFIG_SDIO_HCI = y
CONFIG_USB_HCI = n

################## Other Configuration ########################
CONFIG_MP = n

########### Module Name and HAL Definition ####################
ifeq ($(CONFIG_RTL8188EUS), y)
RTL871X = rtl8188e
endif

ifeq ($(CONFIG_RTL8188FU), y)
RTL871X = rtl8188f
endif

ifeq ($(CONFIG_RTL8821AU), y)
RTL871X = rtl8812a
endif

ifeq ($(CONFIG_RTL8189FS), y)
RTL871X = rtl8188f
endif

ifeq ($(CONFIG_RTL8192FC), y)
RTL871X = rtl8192f
endif

ifeq ($(CONFIG_RTL8821CU), y)
RTL871X = rtl8821c
endif

ifeq ($(CONFIG_RTL8821CS), y)
RTL871X = rtl8821c
endif

WLAN_CHIP_DRIVER_NAME := realtek
MODULE_NAME := hdf_wlan_chip_driver_$(WLAN_CHIP_DRIVER_NAME)

HDF_FRAMEWORK_ROOT := $(LITEOSTOPDIR)/../../drivers/framework
HDM_WLAN_ROOT = $(LITEOSTOPDIR)/../../drivers/framework/model/network/wifi

HDF_INCLUDES += -I $(HDF_FRAMEWORK_ROOT)/include

PLATFORM_INCLUDE += -I $(HDM_WLAN_ROOT)/platform/include \
					-I $(PLATFORM_PATH)/include\
					-I $(LITEOSTOPDIR)/bsd/compat/linuxkpi/include/linux \
					-I src/include \
					-I src/os_dep/harmony \
				    -I src/hal \
					-I src/hal/$(RTL871X) \
					-I src/hal/halmac \
					-I src/hal/phydm \
					-I src/hal/phydm/$(RTL871X) \
					-I src/hal/phydm/halrf \
					-I src/hal/phydm/halrf/$(RTL871X) \
					-I src/platform \
					
LOCAL_SRCS += hdf_wlan_chip_driver.c 
		
LOCAL_SRCS += src/os_dep/harmony/harmony_api.c \
			  src/os_dep/harmony/ioctl_harmony.c \
			  src/os_dep/harmony/harmony_service.c \
			  src/os_dep/harmony/mlme_harmony.c \
			  src/os_dep/harmony/os_intfs.c \
			  src/os_dep/harmony/recv_harmony.c \
			  src/os_dep/harmony/rtw_intf.c \
			  src/os_dep/harmony/rtw_wlan_config.c \
			  src/os_dep/harmony/xmit_harmony.c \
			  src/os_dep/osdep_service.c \
			  src/platform/platform_ops.c

ifeq ($(CONFIG_USB_HCI), y)
LOCAL_SRCS += src/os_dep/harmony/usb_intf.c \
			  src/os_dep/harmony/harmony_usb_ops.c
endif

ifeq ($(CONFIG_SDIO_HCI), y)
LOCAL_SRCS += src/os_dep/harmony/sdio_intf.c \
			  src/os_dep/harmony/harmony_sdio_ops.c
endif

ifeq ($(CONFIG_MP), y)
LOCAL_SRCS += src/os_dep/harmony/ioctl_mp.c
LOCAL_CFLAGS += -DCONFIG_MP_INCLUDED
endif

################ HAL_RTL8188E ##################################
ifeq ($(RTL871X), rtl8188e)
LOCAL_CFLAGS +=  -DCONFIG_RTL8188E
endif

################ HAL_RTL8188F #################################
ifeq ($(RTL871X), rtl8188f)
LOCAL_CFLAGS +=  -DCONFIG_RTL8188F
endif

################ HAL_RTL8821A #################################
ifeq ($(RTL871X), rtl8812a)
LOCAL_CFLAGS+=  -DCONFIG_RTL8821A
endif

################ HAL_RTL8192F #################################
ifeq ($(RTL871X), rtl8192f)
LOCAL_CFLAGS +=  -DCONFIG_RTL8192F
endif

################ HAL_RTL8821C #################################
ifeq ($(RTL871X), rtl8821c)
LOCAL_CFLAGS +=  -DCONFIG_RTL8821C
endif

LOCAL_CFLAGS += $(WIFI_CFLAGS) $(HDF_INCLUDES) $(PLATFORM_INCLUDE)

LOCAL_CFLAGS += -DWLAN_CHIP_DRIVER_NAME=$(WLAN_CHIP_DRIVER_NAME) -DMODULE_NAME=$(MODULE_NAME) -fstack-protector-strong -fno-common -fsigned-char -Wno-error -DCONFIG_LITTLE_ENDIAN -DDM_ODM_SUPPORT_TYPE=0x04 -DPLATFORM_HARMONY

include $(HDF_DRIVER)

